softdeletes laravel

81

ModelName::whereIn('id', [array of ids])
           ->update(['deleted_at' => now()]);

DB::table('table_name')->whereIn('id', [array of ids])
            ->update([
                'deleted_at' => now()
            ]);
Schema::table('flights', function (Blueprint $table) {
    $table->softDeletes();
});
class Clientes extends Model{    use SoftDeletes;    protected $dates = ['deleted_at'];}
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Post extends Model {

    use SoftDeletes;

    protected $table = 'posts';

    // ...
}

Comments

Submit
0 Comments